package fina2.dcs.upload;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import org.jboss.seam.annotations.Name;

@Entity
@Table(name = "SYS_UPLOADEDFILE")
@Name("uploadedFile")
@SuppressWarnings("serial")
public class UploadedFile implements Serializable {
	private long id;
	private String bankCode;
	private String username;
	private BigDecimal userId;
	private String fileName;
	private String status;
	private Date fromDate;
	private Date toDate;
	private Date uploadedTime;
	private String periodCriteria;
	private byte[] uploadedFile;
	private Boolean nameValid;
	private Boolean excelVersionValid;
	private String protectionInfo;
	private String passwordInfo;
	private Boolean hasUserBank;
	private UploadType type;
	private Boolean matrixValid;
	private String reason;
	private boolean marked;

	public UploadedFile() {

	}

	public UploadedFile(UploadType type) {
		this.type = type;
	}

	@Id
	@Column(name = "ID")
	@GeneratedValue(strategy = GenerationType.AUTO)
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	@Column(name = "BANKCODE")
	public String getBankCode() {
		return bankCode;
	}

	public void setBankCode(String bankCode) {
		this.bankCode = bankCode;
	}

	@Column(name = "USERNAME")
	public BigDecimal getUserId() {
		return userId;
	}

	public void setUserId(BigDecimal userId) {
		this.userId = userId;
	}

	@Column(name = "FILENAME")
	public String getFileName() {
		return fileName;
	}

	public void setFileName(String fileName) {
		this.fileName = fileName;
	}

	@Column(name = "STATUS")
	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "UPLOADEDTIME")
	public Date getUploadedTime() {
		return uploadedTime;
	}

	public void setUploadedTime(Date uploadedTime) {
		this.uploadedTime = uploadedTime;
	}

	@Column(name = "UPLOADEDFILE")
	public byte[] getUploadedFile() {
		return uploadedFile;
	}

	public void setUploadedFile(byte[] uploadedFile) {
		this.uploadedFile = uploadedFile;
	}

	@Column(name = "NAMEVALID")
	public Boolean isNameValid() {
		return nameValid;
	}

	public void setNameValid(Boolean nameValid) {
		this.nameValid = nameValid;
	}

	@Column(name = "VERSIONVALID")
	public Boolean isExcelVersionValid() {
		return excelVersionValid;
	}

	public void setExcelVersionValid(Boolean excelVersionValid) {
		this.excelVersionValid = excelVersionValid;
	}

	@Column(name = "PROTECTIONINFO")
	public String getProtectionInfo() {
		return protectionInfo;
	}

	public void setProtectionInfo(String protectionInfo) {
		this.protectionInfo = protectionInfo;
	}

	@Column(name = "PASSWORDINFO")
	public String getPasswordInfo() {
		return passwordInfo;
	}

	public void setPasswordInfo(String passwordInfo) {
		this.passwordInfo = passwordInfo;
	}

	@Column(name = "HASUSERBANK")
	public Boolean isHasUserBank() {
		return hasUserBank;
	}

	public void setHasUserBank(Boolean hasUserBank) {
		this.hasUserBank = hasUserBank;
	}

	@Column(name = "TYPE")
	@Enumerated(EnumType.ORDINAL)
	public UploadType getType() {
		return type;
	}

	public void setType(UploadType type) {
		this.type = type;
	}

	@Column(name = "MATRIXVALID")
	public Boolean getMatrixValid() {
		return matrixValid;
	}

	public void setMatrixValid(Boolean matrixValid) {
		this.matrixValid = matrixValid;
	}

	@Column(name = "REASON")
	public String getReason() {
		return reason;
	}

	public void setReason(String reason) {
		this.reason = reason;
	}

	@Transient
	public boolean isMarked() {
		return marked;
	}

	public void setMarked(boolean marked) {
		this.marked = marked;
	}

	@Transient
	public Date getFromDate() {
		return fromDate;
	}

	public void setFromDate(Date fromDate) {
		this.fromDate = fromDate;
	}

	@Transient
	public Date getToDate() {
		return toDate;
	}

	public void setToDate(Date toDate) {
		this.toDate = toDate;
	}

	@Transient
	public String getPeriodCriteria() {
		return periodCriteria;
	}

	public void setPeriodCriteria(String periodCriteria) {
		this.periodCriteria = periodCriteria;
	}

	@Transient
	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String toString() {
		return "[id=" + id + " ; username=" + username + " ; FI=" + bankCode + "]";
	}
}
